<%@ page contentType="text/html; charset=utf-8" %>
<%@ include file="common.jsp" %>

<%request.setCharacterEncoding("utf-8");
            String username = request.getParameter("username");//此处必须进行编码转换，否则输入中文用户名时将出现乱码

            try {
                java.util.Collection l = bookDB.getMemberName(username);
                java.util.Iterator i = l.iterator();
                Member1 bt = null;
                if (i.hasNext()) {
                    bt = (Member1) i.next();              
                    String PWD = request.getParameter("password");
                    if (PWD.equals(bt.getPassWord())) {
                        session.setAttribute("UserName", username);
                        out.println("<script language='javascript'>alert('登陆成功！！');window.location.href='bookstore.jsp';</script>");


                    } else {
                        out.println("<script language='javascript'>alert('您输入的用户名或密码错误，请与管理员联系!');window.location.href='logo.jsp';</script>");
                    }
                } else {
                    out.println("<script language='javascript'>alert('您输入的用户名或密码错误，或您的帐户已经被冻结，请与管理员联系!');window.location.href='logo.jsp';</script>");
                }
            } catch (Exception e) {
                out.println("<script language='javascript'>alert('您的操作有误!');window.location.href='logo.jsp';</script>");
            }
%> 

